package com.example.register_demo.userDatabase

import androidx.lifecycle.LiveData
import androidx.room.*

@Dao
interface UserDAO {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insertRegister(entity: UserEntity)
    @Delete
    fun deleteAccount(entity: UserEntity)
    @Update
    fun updateAccount(entity: UserEntity)
    @Query("select * from user_info where account=:phone")
    fun getLoginInfo(phone:String):List<UserEntity>

    @Query("select * from user_info where account=:phone")
    fun getRealTimeUser(phone:String):LiveData<List<UserEntity>>  // 这里对数据库内容进行实时的更新

    @Query("select * from user_info where remember==1")
    fun getRemember():List<UserEntity>

    @Query("select * from user_info ")
    fun getAll():List<UserEntity>
}